"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Shape = /** @class */ (function () {
    function Shape() {
    }
    return Shape;
}());
;
var Circle = /** @class */ (function (_super) {
    __extends(Circle, _super);
    function Circle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Circle.prototype.draw = function () {
        console.log('画出一个圆形');
    };
    return Circle;
}(Shape));
var Rectangle = /** @class */ (function (_super) {
    __extends(Rectangle, _super);
    function Rectangle() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Rectangle.prototype.draw = function () {
        console.log('画出一个矩形');
    };
    return Rectangle;
}(Shape));
var Star = /** @class */ (function (_super) {
    __extends(Star, _super);
    function Star() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    Star.prototype.draw = function () {
        console.log('画出一个星形');
    };
    return Star;
}(Shape));
//装饰器模式
var ColorfulShape = /** @class */ (function (_super) {
    __extends(ColorfulShape, _super);
    function ColorfulShape(shape) {
        var _this = _super.call(this) || this;
        _this.shape = shape;
        return _this;
    }
    return ColorfulShape;
}(Shape));
;
var RedColorfulShape = /** @class */ (function (_super) {
    __extends(RedColorfulShape, _super);
    function RedColorfulShape() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RedColorfulShape.prototype.draw = function () {
        this.shape.draw();
        console.log('把边框涂成红色');
    };
    return RedColorfulShape;
}(ColorfulShape));
var GreenColorfulShape = /** @class */ (function (_super) {
    __extends(GreenColorfulShape, _super);
    function GreenColorfulShape() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GreenColorfulShape.prototype.draw = function () {
        this.shape.draw();
        console.log('把边框涂成绿色');
    };
    return GreenColorfulShape;
}(ColorfulShape));
//画出一个绿色的圆形
var greenColorfulShape = new GreenColorfulShape(new Circle());
greenColorfulShape.draw();
//画出一个红色的星形
var redColorfulShape = new RedColorfulShape(new Star());
redColorfulShape.draw();
